-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes logging in with empty or null values #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would fix it yes, but let's rely on the built-in validation from the editForm instead. We are already using a viewModel with attributes for validation here, so we should be able to rely on that. I must have misconfigured something for the form when I created it, so that it fires the function before it validates if it is correct or not.
Let's investigate what is causing the bypassing of the existing validation, and fix that instead
Ah, thanks for the hint @TTA777! The bypassing is caused by adding the login method call to the button's The only downside to this solution is that the button is enabled despite the empty field, and only on attempted submit the field will show that the password cannot be empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find, all good for me then. If the enabled button annoys you, you can look into the example. At least one of them has a disable button until the form is valid, though we may need to change the form type then. Also not something that bothers me
I just tried to see if it was possible, but I am not able to change that behaviour without introducing other unwanted behaviour. What we can do, but gives other behaviour, is: Change the EditForm to use Context instead of Model. The issue with this is: On load, the button will call the
The current version only validates each field individually on field changes and I couldn't figure out a way to combine this with the button disabled/enabled without adding much more code complexity. It might, as you say, require us to change away from the EditForm but I don't think that is worth it. I'll merge this but if our PO wants it in the future we have some idea of how to fix it / what our options are. |
Fixes #40